<template>
  <div id="app">
    <q-header :nav-list="navList"></q-header>
    <div class="main">
      <keep-alive>
        <router-view>
        </router-view>
      </keep-alive>
    </div>
    <q-footer></q-footer>
  </div>
</template>

<script>
  import QHeader from 'components/header/header'
  import QFooter from 'components/footer/footer'
  import IContent from 'base/content/content'
  import Side from 'components/side/side'
  import axios from 'axios'
  import {ERR_OK} from 'api/config'

  export default {
    data() {
      return{
        navList: []
      }
    },
    created() {
      this._getNavData()
    },
    methods: {
      _getNavData() {
        axios.get('/api/getIndexData').then((res) => {
          if (res.data.code === ERR_OK) {
            setTimeout(() => {
              let data = res.data.data
              this.navList = data.navList
            }, 1000)
          }
        }).catch(err => {
          console.log(err)
        })
      }
    },
    components: {
      QHeader,
      QFooter,
      Side,
      IContent
    }
  }
</script>

<style scoped lang="stylus" rel="stylesheet/stylus">
  @import "~@/common/stylus/variable.styl"
  @import "~@/common/stylus/mixin.styl"

  .main
    background-color: #fafafa
    .w990p10
      overflow: hidden
</style>
